using System;
using System.Collections.Generic;
using UnityEngine;
using XFGameFramework;
using XFGameFramework.ScriptableObjectSystem;
using XFABManager;

public class MainModule : Module
{
    // 当前模块所使用的资源模块名称
    public override string ProjectName => "MainModule";


    // 是否为基础模块，基础模块不可关闭，如果模块能够关闭，请设置为false
    public override bool BaseModule => true;

    // 默认启动的场景的名称，如果不需要启动场景保持默认即可
    public override string DefaultStartUpScene => "Start";

    // 需要预加载的表(仅支持json) key:json文件名称 value:类型
    public override Dictionary<string, Type> PreloadConfigTables => base.PreloadConfigTables;

    // 当模块启动时触发
    public override void OnStart()
    {
        UnityEngine.Debug.Log("OnStart:" + ModuleName);
        // 注册音频控制器
        AudioPlayer.RegisterAudioController("Music", true);
        AudioPlayer.RegisterAudioController("Sound", false);

        LoadController<GameController>().SetGameState(GameState.Start);

                // 加载配表
        ScriptableObjectConfigs locationConfig = AssetBundleManager.LoadAsset<ScriptableObjectConfigs>("MainModule", "LocationConfig");
        ScriptableObjectConfigs foodConfig = AssetBundleManager.LoadAsset<ScriptableObjectConfigs>("MainModule", "FoodConfig");
        ScriptableObjectConfigs fightConfig = AssetBundleManager.LoadAsset<ScriptableObjectConfigs>("MainModule", "EnemyConfig");
        // 添加给配表系统
        ScriptableObjectManager.AddConfig(fightConfig);
        ScriptableObjectManager.AddConfig(locationConfig);
        ScriptableObjectManager.AddConfig(foodConfig);

    }
}
